/* Copyright (c) 2004-2024 peigen.info. All rights reserved. */

package info.peigen.hotpot.business.account.manage.convertor;

import cn.hutool.core.bean.BeanUtil;
import info.peigen.hotpot.business.account.core.domain.account.AccountTransLog;
import info.peigen.hotpot.business.account.core.repository.entity.AccountTransLogEntity;
import info.peigen.hotpot.business.account.manage.form.AccountTransLogManageCreateForm;
import info.peigen.hotpot.business.account.manage.form.AccountTransLogManageEditForm;
import info.peigen.hotpot.business.account.manage.form.AccountTransLogManageSearchForm;
import info.peigen.hotpot.business.account.manage.info.AccountTransLogManageInfo;
import info.peigen.hotpot.common.core.util.IdUtil;
import lombok.extern.slf4j.Slf4j;

/**
 * <b>(AccountTransLogManageConvertor)</b>
 * 管理后台领域对象 "账户交易流水记录" 转换器
 *
 * @author Peigen
 * @version 1.0.0
 * @since 2023-08-30
 */
@SuppressWarnings("unused")
@Slf4j
public class AccountTransLogManageConvertor {
    // ConvertToEntity
    public static AccountTransLogEntity convertToEntity(AccountTransLog domain) {
        return BeanUtil.copyProperties(domain, AccountTransLogEntity.class);
    }

    public static AccountTransLogEntity convertToEntity(AccountTransLogManageInfo info) {
        return BeanUtil.copyProperties(info, AccountTransLogEntity.class);
    }

    public static AccountTransLogEntity convertToEntity(AccountTransLogManageSearchForm form) {
        return BeanUtil.copyProperties(form, AccountTransLogEntity.class);
    }

    public static AccountTransLogEntity convertToEntity(AccountTransLogManageCreateForm form) {
        if (form.getTransLogId() == null) {
            form.setTransLogId(IdUtil.id());
        }
        return BeanUtil.copyProperties(form, AccountTransLogEntity.class);
    }

    public static AccountTransLogEntity convertToEntity(AccountTransLogManageEditForm form) {
        return BeanUtil.copyProperties(form, AccountTransLogEntity.class);
    }

    // ConvertToDomain
    public static AccountTransLog convertToDomain(AccountTransLogEntity entity) {
        return BeanUtil.copyProperties(entity, AccountTransLog.class);
    }

    public static AccountTransLog convertToDomain(AccountTransLogManageInfo info) {
        return BeanUtil.copyProperties(info, AccountTransLog.class);
    }

    public static AccountTransLog convertToDomain(AccountTransLogManageSearchForm form) {
        return BeanUtil.copyProperties(form, AccountTransLog.class);
    }

    public static AccountTransLog convertToDomain(AccountTransLogManageCreateForm form) {
        if (form.getTransLogId() == null) {
            form.setTransLogId(IdUtil.id());
        }
        return BeanUtil.copyProperties(form, AccountTransLog.class);
    }

    public static AccountTransLog convertToDomain(AccountTransLogManageEditForm form) {
        return BeanUtil.copyProperties(form, AccountTransLog.class);
    }

    // convertToInfo
    public static AccountTransLogManageInfo convertToInfo(AccountTransLog domain) {
        return BeanUtil.copyProperties(domain, AccountTransLogManageInfo.class);
    }

    public static AccountTransLogManageInfo convertToInfo(AccountTransLogEntity entity) {
        return BeanUtil.copyProperties(entity, AccountTransLogManageInfo.class);
    }

    public static AccountTransLogManageInfo convertToInfo(AccountTransLogManageSearchForm form) {
        return BeanUtil.copyProperties(form, AccountTransLogManageInfo.class);
    }

    public static AccountTransLogManageInfo convertToInfo(AccountTransLogManageCreateForm form) {
        if (form.getTransLogId() == null) {
            form.setTransLogId(IdUtil.id());
        }
        return BeanUtil.copyProperties(form, AccountTransLogManageInfo.class);
    }

    public static AccountTransLogManageInfo convertToInfo(AccountTransLogManageEditForm form) {
        return BeanUtil.copyProperties(form, AccountTransLogManageInfo.class);
    }
}